<template>
  <div class="about">
    <h1>This is an about page</h1>
    <button @click="addCount">全局{{$store.state.count}}</button>
    <button @click="setInfo">信息{{$store.state.info}}</button>
    <p>{{$route.params}}</p>
  </div>
</template>

<script>

  import {mapMutations,mapActions} from 'vuex'
  export default{

    name:"about",

    methods:{
      // addCount(e){
      //
      //   this.$store.commit("increment",e)
      // }
      ...mapMutations({
        addCount:'increment'  //效果跟addCount(e) 一样
      }),
      ...mapActions(['setInfo'])
      // setInfo(){
      //   //this.$store.commit("setInfo","异步")
      //   this.$store.dispatch("setInfo");
      // }
    }
  }
</script>
